const adminUserModule = {
	state:{
		forcedLogin: false,//是否需要强制登录
		hasLogin: false, //是否已经登录
		userId:'', //用户ID
		token:'', //token
		userInfo:{},
		adminType:0,
		adminAgentPageShow:true,
		loginCode:''
	},
	mutations:{
		setAdminToken(state,token){
			state.token = token
			uni.setStorageSync('adminToken',state.token)
		},
		setAdminType(state,type){
			state.adminType = type
			uni.setStorageSync('adminType',state.adminType)
		},
		setAdminAgentPageShow(state,agentPageShow){
			state.adminAgentPageShow = agentPageShow
			uni.setStorageSync('adminIsAgent',state.adminAgentPageShow)
		},
		setAdminUserid(state,userId){
			state.userId = userId
			uni.setStorageSync('adminUserId',state.userId)
		},
		setLoginCode(state,code){
			state.loginCode = code
			uni.setStorageSync('loginCode',state.loginCode)
		}
	},
	actions:{
		setUserInfo(context,params){
			context.commit('setAdminToken',params.token)
			context.commit('setAdminType',params.type)
			// context.commit('setAdminAgentPageShow',params.agentPageShow)
			// context.commit('setAdminUserid',params.userId)
		},
		//登录设置
		setAdminInfo(context,params){
			context.commit('setAdminToken',params.token)
			context.commit('setAdminType',params.type)
			context.commit('setAdminAgentPageShow',params.agentPageShow)
			context.commit('setAdminUserid',params.userId)
		},
		setAdminAgentPageShow(context){
			context.commit('setAdminAgentPageShow',false)
		},
		setLoginCode(context,code){
			context.commit('setLoginCode',code)
		},
		//后台登出
		setAdminLogout(context){
			context.commit('setAdminType',1)
			context.commit('setAdminAgentPageShow',false)
			context.commit('setAdminUserid','')
		}
	},
	getters:{
		getToken(state){
			return state.token
		},
		getAdminType(state){
			return state.adminType
		},
		getAdminAgentPageShow(state){
			return state.adminAgentPageShow
		}
	}
}
export default adminUserModule